package com.wkr.thread;

import com.wkr.bean.StringBean;
import com.wkr.container.MqContainer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Date;

public class wkrThread implements Runnable {
    private MqContainer mqContainter;//消息队列容器

    private static final Logger log = LoggerFactory.getLogger(wkrThread.class);

    public wkrThread(MqContainer mqContainter) {
       this.mqContainter = mqContainter;
    }

    @Override
    public void run() {
        while (true) {
            if (mqContainter.getQueue().size() > 0) {//这种是及时处理消息
                log.info("逻辑处理开始");
                StringBean stringBean = (StringBean) this.mqContainter.getQueue().poll();
                log.info("逻辑处理结束,信息出队:" + stringBean.getName());
            }
        }
    }
}
